﻿#ifndef AVSSPECTROMETERUTILS_H
#define AVSSPECTROMETERUTILS_H

#include <QObject>
#include <memory> // shared_ptr
#include <mutex>  // mutex

#include "spectrometerdata.h"
#include "avaspec.h"
#include "BaseSpectroMeter.h"

#pragma pack(push)
#pragma pack(1)
typedef struct AvspecInfoTag{
    char marker[5];
    uint8 numspectra;
    uint32 length;
    uint8 seqnum;
    uint8 measmode ;
    uint8 bitness;
    uint8 SDmarker;
    AvsIdentityType identity;
    MeasConfigType measconf;
    unsigned long timestamp;
    unsigned long SPCfiledate;
    float detectortemp ; // calculated detectortemperature
    float boardtemp; // calculated board temperature
    float NTC2volt; // raw voltage from NTC2
    float ColorTemp; // used in calculation of relative irradiance, without lampfile
    float CalIntTime; // integration time used in intensity calibration
    double fitdata[5]; // array of 5 doubles, the wavelength calibration polynomial
    char comment[130]; // same size as in SPC

}AvspecInfo;

class AvsSpectroMeterUtils : public QObject
{
    Q_OBJECT
public:
    explicit AvsSpectroMeterUtils(QObject *parent = nullptr);

    static AvsMeasResult Parse(QString filename);
    
    static double AutoCalcIntegrationTime(BaseSpectroMeter *meter);
signals:

public slots:
};

#endif // AVSSPECTROMETERUTILS_H
